<?php include 'header.php' ?>
<?php
include 'mySQLConnect.php';

$id = $_GET['id'];
$sql3 = "SELECT * FROM news WHERE id = '$id'";

$result3 = mysql_query($sql3);

$date = "";
$image_url = "";
$short_desc = "";
$description = "";
$name = "";

while ($row3 = mysql_fetch_array($result3)) {
    $image_url = $row3['image_url'];

    if (strpos($image_url, '../') !== false) {
        $image_url = substr($image_url, 3);
    }

    $date = date("d M", time($row3['date']));
    $short_desc = urldecode($row3['short_desc']);
    $description = urldecode($row3['description']);
    $name = urldecode($row3['name']);
}

include 'mySQLClose.php';
?>

    <div class="container_12 primary_content_wrap clearfix">
        <div class="grid_8 right" id="content" style="width: 920px;">
            <article
                class="post-77 post type-post status-publish format-standard hentry category-adipisicing-eliters-sed-do-eiusmod tag-augue-quis tag-bibendum-mauris tag-elit tag-ipsum-dolor tag-tempor post-holder cat-7-id"
                id="post-77" style="margin-bottom: 5px;">
                <header class="entry-header single">
                    <div class="post-head-right">
                        <h1 class="entry-title"><?php echo urldecode($name) ?></h1>
                    </div>
                </header>
                <div class="featured-thumbnail large">
                    <?php echo urldecode($short_desc) ?>
                </div>
                <div class="clear"></div>
                <div class="content">
                    <?php echo urldecode($description) ?>

                    <br/><br/>

                    <div class="addthis_toolbox addthis_default_style tm_style">
                        <a class="addthis_button_facebook_like at300b">
                            <div class="fb-like"
                                 data-href="http://localhost/laptop"
                                 data-send="true" data-width="920" data-show-faces="true"></div>
                            <br/>

                            <div class="fb-comments"
                                 data-href="http://localhost/laptop"
                                 data-width="600" data-num-posts="10"></div>
                            <div class="clear"></div>
                        </a>
                    </div>
                </div>
                <div class="clear"></div>
            </article>
            <div class="giohang"> <h3>Các bài viết khác</h3></div>
            <ul>
                <?php include 'mySQLConnect.php';

                $sql3 = "SELECT * FROM news WHERE id <> '$id' ORDER BY date DESC LIMIT 0,10";

                $result3 = mysql_query($sql3);
                while ($row3 = mysql_fetch_array($result3)) {
                    $image_url = $row3['image_url'];

                    if (strpos($image_url, '../') !== false) {
                        $image_url = substr($image_url, 3);
                    }
                    ?>
                    <li>
                        <a href="detailNews.php?id=<?php echo $row3['id'] ?>">
                            <?php echo urldecode($row3['name']) ?></a>
                    </li>
                <?php
                }
                include 'mySQLClose.php';
                ?>
            </ul>
        </div>
    </div>
<?php include 'footer.php' ?>